const path = require('path');
const htmlPlugin= require('html-webpack-plugin');
const extractTextPlugin = require("extract-text-webpack-plugin");
const PurifyCSSPlugin = require("purifycss-webpack");
const glob = require('glob');
const webpack = require('webpack');
module.exports = [
    // new uglify(),
    new webpack.BannerPlugin('邱阳2016-1-22'),
    new webpack.ProvidePlugin({
        $:'jquery',
        Vue:"vue"
    }),
    new extractTextPlugin("css/base.css"),
    new htmlPlugin({
        minify:{
            removeAttributeQuotes:true
        },
        hash:true,
        template:'./src/index.html'
    }),
    new PurifyCSSPlugin({
        // Give paths to parse for rules. These should be absolute!
        paths: glob.sync(path.join(__dirname, '../src/*.html'))
    }),
    new webpack.optimize.CommonsChunkPlugin({
        //name对应入口文件中的名字，我们起的是jQuery
        name:['jquery','vue'],
        //把文件打包到哪里，是一个路径
        filename:"assets/js/[name].min.js",
        //最小打包的文件模块数，这里直接写2就好
        minChunks:3
    }),
    new webpack.HotModuleReplacementPlugin()
];